local CSGuildWarGuildInfo = class("CSGuildWarGuildInfo")
local GuildBaseInfo = import(".GuildBaseInfo")

function CSGuildWarGuildInfo:ctor()
    self._baseGuildInfo = nil
    self._winCount = 0 -- 胜利次数
    self._loseCount = 0 -- 失败次数
    self._rank = 0 --排名
    self._memberLife = 0 --成员生命
    self._score = 0 -- 战绩积分
    self._matchIndex = nil
end

function CSGuildWarGuildInfo:read(pbData)
    if not pbData then
        return
    end
    local guildInfo = rawget(pbData, "info")
    if guildInfo then
        self._baseGuildInfo = GuildBaseInfo.new()
        self._baseGuildInfo:read(guildInfo)
    else
        self._baseGuildInfo = nil
    end
    self._winCount = rawget(pbData, "winTimes") or 0
    self._loseCount = rawget(pbData, "loseTimes") or 0
    self._score = rawget(pbData, "score") or 0
    self._rank = rawget(pbData, "rank") or 0
    self._memberLife = rawget(pbData, "life") or 0
end


function CSGuildWarGuildInfo:getTotalPowerStr()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getTotalPowerStr()
    end
    return ""
end

function CSGuildWarGuildInfo:getServerName()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getServerName()
    end
    return ""
end

function CSGuildWarGuildInfo:getRank()
    return self._rank
end

function CSGuildWarGuildInfo:getScore()
    return self._score
end

function CSGuildWarGuildInfo:getGuildName()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getGuildName()
    end
    return ""
end

function CSGuildWarGuildInfo:getGuildId()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getGuildId()
    end
    return ""
end

function CSGuildWarGuildInfo:getGuildMemberNum()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getGuildMemberNum()
    end
    return 0
end

function CSGuildWarGuildInfo:getGuildIconData()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getGuildIconData()
    end
end

function CSGuildWarGuildInfo:getMemberLifeNum()
    return self._memberLife
end

function CSGuildWarGuildInfo:getWinCount()
    return self._winCount
end

function CSGuildWarGuildInfo:getLoseCount()
    return self._loseCount
end

function CSGuildWarGuildInfo:getServerIndex()
    if self._baseGuildInfo then
        return self._baseGuildInfo:getServerIndex()
    end
    return 0
end

function CSGuildWarGuildInfo:isMyGuild()
    if self._baseGuildInfo then
        return self._baseGuildInfo:isMyGuild()
    end
    return false
end

function CSGuildWarGuildInfo:setMatchIndex(index)
    self._matchIndex = index
end

function CSGuildWarGuildInfo:getMatchIndex()
    return self._matchIndex
end


return CSGuildWarGuildInfo